var mongoose = require('../data/db').mongoose;
var Schema =  mongoose.Schema;
var schema = new mongoose.Schema({
    username:String,
    password:String,
    departmentid:{ type : String, default : '0'},
    nickname:String,
    gender:{type : String, default : '0'},
    age:String,
    birth:String,
    address:String,
    email:String,
    telephone:String,
    duty:String,
    handfreetelephone:String,
    qq:String,
    weixin:String,
    dutystatus:{type : String, default : '0'},
    headportrait:String,
    loginstate:{type : String, default : '0'},//登录状态 0 允许登录 1不允许登录
    role:{type : String, default : '2'},//0超级管理员 1 管理员  2普通用户 3销售 4库管
    isdelete:{type : String, default : '0'},//删除状态 0未删除 1已删除
    createtime:{type : Date, default: Date.now},
    updatetime:{type : Date, default: Date.now},
    operator:{ type: Schema.Types.ObjectId, ref: 'users' }
});

var user = mongoose.model('users',schema);
module.exports  = user;